﻿using System;

namespace DivShare
{
    /// <summary>
    /// Provides data for the <see cref="E:DownloadWebFileCompleted"/> event of a <see cref="DivShareClient"/>.
    /// </summary>
    public class DownloadWebFileCompletedEventArgs : EventArgs
    {
        /// <summary>
        /// Gets a value indicating which error occurred during downloading webfile.
        /// </summary>
        /// <value>An <see cref="Exception"/> instance, if an error occurred during downloading webfile; otherwise <c>null</c>.</value>
        public Exception Error { get; protected set; }

        /// <summary>
        /// Gets the webfile that is downloaded by a <see cref="M:DownloadWebFileAsync"/> method.
        /// </summary>
        /// <value>The webfile.</value>
        public WebFile WebFile { get; protected set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="DownloadWebFileCompletedEventArgs"/> class.
        /// </summary>
        /// <param name="webFile">The webfile that is downloaded.</param>
        /// <param name="ex">The exception occured during downloading webfile.</param>
        internal DownloadWebFileCompletedEventArgs(WebFile webFile, Exception ex)
        {
            WebFile = webFile;
            Error = ex;
        }
    }
}
